import request from '@/utils/request'
import axios from 'axios';

// 登录接口 
export const login = (params) => {
	return loginreq("post", "/api/login", params)
};

// 退出接��?
export const loginout = () => {
	return axios.delete("/api/login?&token=" + localStorage.getItem('logintoken')).then(res => res.data)
};


// 登录验证
export const loginUser = (data) => {
	return request({
		url: '/login/login',
		method:'post',
		data
	})
}


// 模糊搜索
export const examsearch = (params) =>{
	return request({
		url:"/exam/getExamsByFuzzySearch",
		method:"get",
		params
	})
}

export const classroomsearch = (params) =>{
	return request({
		url:"/classroom/getClassroomsByFuzzySearch",
		method:"get",
		params
	})
}

export const coursesearch = (params) =>{
	return request({
		url:"/course/getCoursesByFuzzySearch",
		method:"get",
		params
	})
}

export const classsearch = (params) =>{
	return request({
		url:"/cclass/getClassesByFuzzySearch",
		method:"get",
		params
	})
}

export const studentsearch = (params) =>{
	return request({
		url:"/student/getStudentsByFuzzySearch",
		method:"get",
		params
	})
}

export const booksearch = (params) =>{
	return request({
		url:"/book/getBooksByFuzzySearch",
		method:"get",
		params
	})
}

export const infosearch = (params) =>{
	return request({
		url:"/info/getInfosByFuzzySearch",
		method:"get",
		params
	})
}

// 添加数据
export const examInsert = (params) =>{
	return request({
		url:"/exam/insertExam",
		method:"get",
		params
	})
}

export const bookInsert = (params) =>{
	return request({
		url:"/book/insertBook",
		method:"get",
		params
	})
}

export const courseInsert = (params) =>{
	return request({
		url:"/course/courseInsert",
		method:"get",
		params
	})
}

export const classInsert = (params) =>{
	return request({
		url:"/cclass/classInsert",
		method:"get",
		params
	})
}

export const studentInsert = (params) =>{
	return request({
		url:"/student/studentInsert",
		method:"get",
		params
	})
}

export const classroomInsert = (params) =>{
	return request({
		url:"/classroom/insertClassroom",
		method:"get",
		params
	})
}

//修改数据
export const examEdit = (params) =>{
	return request({
		url:"/exam/edit",
		method:"get",
		params
	})
}

export const bookEdit = (params) =>{
	return request({
		url:"/book/edit",
		method:"get",
		params
	})
}

export const courseEdit = (params) =>{
	return request({
		url:"/course/edit",
		method:"get",
		params
	})
}

export const classEdit = (params) =>{
	return request({
		url:"/cclass/edit",
		method:"get",
		params
	})
}

export const studentEdit = (params) =>{
	return request({
		url:"/student/edit",
		method:"get",
		params
	})
}

export const infoEdit = (params) =>{
	return request({
		url:"/info/edit",
		method:"get",
		params
	})
}


export const classroomEdit = (params) =>{
	return request({
		url:"/classroom/edit",
		method:"get",
		params
	})
}


//删除数据
export const examDelete = (params) =>{
	return request({
		url:"/exam/deleteById",
		method:"get",
		params
	})
}

export const bookDelete = (params) =>{
	return request({
		url:"/book/deleteById",
		method:"get",
		params
	})
}

export const courseDelete = (params) =>{
	return request({
		url:"/course/deleteById",
		method:"get",
		params
	})
}

export const classDelete = (params) =>{
	return request({
		url:"/cclass/deleteById",
		method:"get",
		params
	})
}

export const studentDelete = (params) =>{
	return request({
		url:"/student/deleteById",
		method:"get",
		params
	})
}

export const classroomDelete = (params) =>{
	return request({
		url:"/classroom/deleteById",
		method:"get",
		params
	})
}

export const getMainData = (params) =>{
	return request({
		url:"/data/getMainData",
		method:"get",
		params
	})
}

export const getClassApplyCountForPie = (params) =>{
	return request({
		url:"data/getClassApplyCountForPie",
		method:"get",
		params
	})
}